To ensure security of an operating system kernel, a user program can obtain, using a system call command, a service provided by the operating system, kernel. For example, the user program can open a file, close as file, or read/write a file using a system call command related to a file system. A request of the user program is completed in the kernel using the system call command, and a processing result is returned to the user program. A kernel refers to system software providing functions such as a hardware abstraction layer disk and file system control, and multitasking.
Because frequent context switches exist in a conventional Linux system, overheads for calling the context switches by the system are relatively large and system work efficiency is low. To resolve the call problem of the conventional Linux system, a method for system call command batch processing is put forward in the prior art. The overheads for calling the context switches by the system include overheads for saving, an operating environment of a current task and restoring an operating environment of a to-be-operated task. One system call task includes multiple system call commands. Specifically, a cache table for system call command batch processing is set in a kernel, multiple system call commands are distributed to different CPU cores according to a sequence of entering the kernel and are concurrently executed, and processing results are returned to a user program, so that context switch overheads caused by a conventional system call can be saved.
However, when multiple system call commands are distributed, for processing, to different CPU cores using the method for system call command batch processing put forward in the prior art, because system call commands of one system call task may be distributed to different CPU cores fur processing, returned results of the system call task may be non-sequential. For example, multiple system call commands of one system call task enter a kernel in a sequence of system call command 1, system call command 2, and system call command 3. An operating system randomly schedules the three system call commands to three CPU cores for processing. Because the foregoing three system call commands are respectively processed in the three CPU cores at different speeds, returned results of the system call task may not be returned in the sequence of entering the kernel by the system call commands. As a result, the returned results of the system call task are non-sequential.